/*
**********************************************************************************************
MENU VERTICAL 
**********************************************************************************************
*/
            menu_doc = document;

            function menujs(ids) {
               var cont = "menujs";
               var cont_tag = "div";
               var x = menu_doc.getElementById(cont).getElementsByTagName(cont_tag).length;
               var idstring = "";

               for (k = 0; k < x; k++) {
                 idstring += menu_doc.getElementById('menujs').getElementsByTagName(cont_tag)[k].id + ";";
               }
               
               if (menu_doc.getElementById(ids).style.display == "none") {
                 menu_doc.getElementById(ids).style.display = "block";
               } else {
                 menu_doc.getElementById(ids).style.display = "none";
               }

            }


            function ocultar_menu_principal(){
                document.getElementById("v_menu").value="0";
                document.getElementById("td_menu").style.display="none";
                document.getElementById("td_ver_menu").style.display="";
            }


            function ver_menu_principal(){
                document.getElementById("v_menu").value="1";
                document.getElementById("td_menu").style.display="";
                document.getElementById("td_ver_menu").style.display="none";
            }


/*
**********************************************************************************************
MENU HORIZONTAL
**********************************************************************************************
*/

        //---------------
        //Popup Control 
        //---------------
        function at_display(x)
        {
          win = window.open();
          for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
        }

        //---------------
        //Show Aux
        //---------------
        function at_show_aux(parent, child)
        {
          var p = document.getElementById(parent);
          var c = document.getElementById(child);

          var top  = (c["at_position"] == "y") ? p.offsetHeight+0 : 0;
          var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

          var temp =  p.offsetWidth;
          var temp1 =  c.offsetWidth;

          for (; p; p = p.offsetParent)
          {
            top  += p.offsetTop;
            left += p.offsetLeft;
          }

          left = left - (temp1 - temp);

          c.style.position   = "absolute";
          c.style.top        = top +'px';
          c.style.left       = left+'px';
          c.style.visibility = "visible";
        }

        //---------------
        //Show
        //---------------
        function at_show()
        {
          p = document.getElementById(this["at_parent"]);
          c = document.getElementById(this["at_child" ]);

          at_show_aux(p.id, c.id);

          clearTimeout(c["at_timeout"]);
        }

        //---------------
        //Hide
        //---------------
        function at_hide()
        {
          c = document.getElementById(this["at_child"]);

          c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
        }

        //---------------
        //Click
        //---------------
        function at_click()
        {
          p = document.getElementById(this["at_parent"]);
          c = document.getElementById(this["at_child" ]);

          if (c.style.visibility != "visible") at_show_aux(p.id, c.id);
          else c.style.visibility = "hidden";

          return false;
        }


        // ----- Attach -----

        // PARAMETERS:
        // parent   - id of visible html element
        // child    - id of invisible html element that will be dropdowned
        // showtype - "click" = you should click the parent to show/hide the child
        //            "hover" = you should place the mouse over the parent to show
        //                      the child
        // position - "x" = the child is displayed to the right of the parent
        //            "y" = the child is displayed below the parent
        // cursor   - Omit to use default cursor or check any CSS manual for possible
        //            values of this field

        function at_attach(parent, child, showtype, position, cursor)
        {
          p = document.getElementById(parent);
          c = document.getElementById(child);

          p["at_parent"]     = p.id;
          c["at_parent"]     = p.id;
          p["at_child"]      = c.id;
          c["at_child"]      = c.id;
          p["at_position"]   = position;
          c["at_position"]   = position;

          c.style.position   = "absolute";
          c.style.visibility = "hidden";

          if (cursor != undefined) p.style.cursor = cursor;

          switch (showtype)
          {
            case "click":
              p.onclick     = at_click;
              p.onmouseout  = at_hide;
              c.onmouseover = at_show;
              c.onmouseout  = at_hide;
              break;
            case "hover":
              p.onmouseover = at_show;
              p.onmouseout  = at_hide;
              c.onmouseover = at_show;
              c.onmouseout  = at_hide;
              break;
          }
        }




/*
**********************************************************************************************
MENU FLOTANTE
**********************************************************************************************
*/

            //bloquea el boton derecho
            //document.oncontextmenu=new Function("return false")

            //*****************************************************
            //*** COGE X/Y DEL MOUSE
            //*****************************************************
            /*var IE = document.all?true:false
            if (!IE) document.captureEvents(Event.MOUSEMOVE)
            //document.onmousemove = getMouseXY;

            var tempX = 0
            var tempY = 0
            function getMouseXY(e) {
              if (IE) { // grab the x-y pos.s if browser is IE
                tempX = event.clientX + document.body.scrollLeft
                tempY = event.clientY + document.body.scrollTop
              } else {  // grab the x-y pos.s if browser is NS
                tempX = e.pageX
                tempY = e.pageY
              }    
              if (tempX < 0){tempX = 0}
              if (tempY < 0){tempY = 0}  
              ocultar();
              return true
            }*/

            //*********************************************************
            // Variables, Metodo Mostrar y Ocultar Menu Flotante
            //*********************************************************
            /*var pos_x = 0;
            var pos_y = 0;
            var temp_pos_x = 0;
            var temp_pos_y = 0;
            var div_ventana = 'div_default';

            function mostrar(ancho, largo, ventana, codigo){

                     document.getElementById(ventana).style.left=tempX - parseInt(ancho);
                     document.getElementById(ventana).style.top=tempY;
                     pos_x = parseInt(tempX) + 2;
                     pos_y = parseInt(tempY) -2;
                     temp_pos_x = parseInt(pos_x) - parseInt(ancho);
                     temp_pos_y = parseInt(pos_y) + parseInt(largo);
                     document.getElementById(ventana).style.visibility='visible';	 	 
                     div_ventana = ventana;

            }

            function ocultar(){
                     if(parseInt(tempX) > pos_x || parseInt(tempX) < temp_pos_x ||  parseInt(tempY) < pos_y || parseInt(tempY) > temp_pos_y ){
                             document.getElementById(div_ventana).style.visibility='hidden';
                     }	 
            }*/


            //*********************************************************
            // Metodos OnMouseOver y OnMouseOut del Menu Flotante
            //*********************************************************
            function borderize_on(e){
                    if (document.all)
                    source3=event.srcElement
                    else if (document.getElementById)
                    source3=e.target

                            while(source3.tagName!="TABLE"){
			source3=document.getElementById? source3.parentNode : source3.parentElement
			if (source3.className=="menulines"){
				source3.style.border = "1px solid #E2A503";
				source3.style.background = "#FEEBBA";				
			}
		}
            }

            function borderize_off(e){
                    if (document.all)
                    source4=event.srcElement
                    else if (document.getElementById)
                    source4=e.target

                            while(source4.tagName!="TABLE"){
                                    source4=document.getElementById? source4.parentNode : source4.parentElement
                                    if (source4.className=="menulines"){				
                                            source3.style.border = "0px solid black";
                                            source3.style.background = "";
                                            source3.style.cursor = "pointer";				
                                    }
                            }
            }

